﻿@namespace MudBlazor
@inherits MudComponentBase

@if (_visibleState.Value)
{
    if (RenderOutsideOfSection)
    {
        @OverlayFragment
    }
    else
    {
        <SectionContent SectionName="mud-overlay-to-popover-provider">
            @OverlayFragment
        </SectionContent>
    }
}

@code {
    private RenderFragment OverlayFragment => 
        @<div @attributes="UserAttributes"
              id="@_elementId"
              class="@Classname"
              style="@Styles"
              @onclick="OnClickHandlerAsync"
              @onclick:stopPropagation>
            @if (LightBackground || DarkBackground)
            {
                <div class="@ScrimClassname"></div>
            }
            @if (ChildContent is not null)
            {
                <div class="mud-overlay-content">
                    @ChildContent
                </div>
            }
        </div>;
}
